package team.seekers.hula.common.entity.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * date: 2022/5/1 0:06
 *
 * @author GH
 * QQ 1124813753
 */
@Getter
@AllArgsConstructor
public enum ProblemTypeEnum {
    CHOICE(0, "单选"),
    CHOICE_PLUS(1, "多选"),
    FILL(2, "填空"),
    ESSAY(3, "问答");

    private int code;
    private String content;

    public static ProblemTypeEnum getByCode(int code) {
        return Arrays.stream(values()).filter(e -> e.getCode() == code).findFirst().orElse(null);
    }

    public static ProblemTypeEnum getByContent(String content) {
        return Arrays.stream(values()).filter(e -> e.getContent().equalsIgnoreCase(content)).findFirst().orElse(null);
    }
}
